Skip to content

fix(chat): remove non-existent status/workspace_id from conversations SELECT#47

Merged
ABB65 merged 1 commit into
mainfrom
fix/conversations-select-missing-columns
May 15, 2026
Merged

fix(chat): remove non-existent status/workspace_id from conversations SELECT#47
ABB65 merged 1 commit into
mainfrom
fix/conversations-select-missing-columns

Conversation

@ABB65
Copy link
Copy Markdown
Member

@ABB65 ABB65 commented May 15, 2026

Summary

  • getConversation SELECT'i status ve workspace_id istiyordu ama bu kolonlar public.conversations'ta hiç yaratılmamış (sadece id, project_id, user_id, title, created_at, updated_at var — 001_baseline.sql:644). Sonuç: her chat isteği column conversations.status does not exist ile 500 dönüyordu.
  • Hatalı SELECT muhtemelen DatabaseProvider abstraction refactor'unda (ba75732) EE ConversationApiContext.project shape'inden yanlışlıkla kopyalandı — bu alanlar projects tablosuna ait, conversations'a değil.
  • Kullanım haritası: chat.post.ts:111, messages.get.ts:15, EE conversation-api.ts:243/357, frontend ConversationSummary (useChat.ts:55) ve ChatPanel.vue — hiçbiri conv.status veya conv.workspace_id okumuyor. Billing/quota scoping zaten agent_usage.workspace_id üzerinde, RLS politikası user_id = auth.uid() — denormalize gerekmiyor. Migration eklemek speculative design olurdu (CLAUDE.md).

Changes

  • server/providers/supabase-db/conversations.ts — SELECT'i id, title, user_id, created_at, updated_at olarak küçülttü, filters.workspaceId branch'ı kaldırıldı (caller yok).
  • server/providers/database.tsgetConversation filter tipinden workspaceId?: string çıkarıldı.

Test plan

  • pnpm typecheck clean
  • pnpm lint — değişen dosyalarda 0 error
  • pnpm test:unit (conversation-routes + chat-route integration dahil) — 403 passed
  • Manuel: staging'de chat akışı (yeni konuşma + mevcut konuşmaya devam) artık 500 vermiyor

… SELECT

The DatabaseProvider abstraction refactor (ba75732) added `status` and
`workspace_id` to the `getConversation` SELECT list, but these columns
were never created on `public.conversations` — the table only has
`id, project_id, user_id, title, created_at, updated_at`. As a result,
every chat request hit `column conversations.status does not exist` and
returned a 500.

No caller reads `conv.status` or `conv.workspace_id` (verified across
chat.post, messages.get, conversation delete, EE conversation-api, and
the ConversationSummary type consumed by ChatPanel / CommandPalette).
Billing/quota scoping already lives on `agent_usage.workspace_id`; the
RLS policy on `conversations` is `user_id = auth.uid()` and does not
need workspace denormalisation. Adding a migration for unused columns
would be speculative design, so this drops the over-selected fields and
the matching `workspaceId?` filter on the provider interface (no caller
passes it).
@ABB65 ABB65 merged commit 300d6d0 into main May 15, 2026
1 of 2 checks passed
@ABB65 ABB65 deleted the fix/conversations-select-missing-columns branch May 15, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant